home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / a_utils / _archvrs / unix / unzip51 / atari / atari.c next >
Encoding:
C/C++ Source or Header  |  1992-10-18  |  2.5 KB  |  86 lines

  1. /*---------------------------------------------------------------------------
  2.  
  3.   atari.c
  4.  
  5.   Atari TOS-specific routines for use with Info-ZIP's UnZip 5.1 and later.
  6.  
  7.   This is basically the MS-DOS version and has never been tested on the
  8.   Atari.  MODIFY AT WILL!  (It almost certainly will not work correctly,
  9.   and probably won't even compile correctly.)
  10.  
  11.   ---------------------------------------------------------------------------*/
  12.  
  13.  
  14. #include "unzip.h"
  15.  
  16.  
  17.  
  18.  
  19. /**********************/
  20. /* Function mapattr() */
  21. /**********************/
  22.  
  23. int mapattr()    /* what do Atari attribute bits mean? */
  24. {
  25.     /* only care about read-only bit, so just look at MS-DOS side of attrs */
  26.     pInfo->read_only = (unsigned)(crec.external_file_attributes & 1);
  27.     return 0;
  28.  
  29. } /* end function mapattr() */
  30.  
  31.  
  32.  
  33.  
  34.  
  35. /**************************************/
  36. /* Function set_file_time_and_close() */
  37. /**************************************/
  38.  
  39. void set_file_time_and_close()
  40. {
  41. #ifdef __TURBOC__
  42.     union {
  43.         struct ftime ft;        /* system file time record */
  44.         struct {
  45.             ush ztime;          /* date and time words */
  46.             ush zdate;          /* .. same format as in .ZIP file */
  47.         } zt;
  48.     } td;
  49. #endif
  50.  
  51.  
  52. /*---------------------------------------------------------------------------
  53.      Do not attempt to set the time stamp on standard output.
  54.   ---------------------------------------------------------------------------*/
  55.  
  56.     if (cflag) {
  57.         close(outfd);
  58.         return;
  59.     }
  60.  
  61. /*---------------------------------------------------------------------------
  62.     Copy and/or convert time and date variables, if necessary; then set the
  63.     file time/date.
  64.   ---------------------------------------------------------------------------*/
  65.  
  66. #ifdef __TURBOC__
  67.     td.zt.ztime = lrec.last_mod_file_time;
  68.     td.zt.zdate = lrec.last_mod_file_date;
  69.     setftime(outfd, &td.ft);
  70. #endif /* ?__TURBOC__ */
  71.  
  72. /*---------------------------------------------------------------------------
  73.     And finally we can close the file...at least everybody agrees on how to
  74.     do *this*.  I think...  Oh yeah, also change the mode according to the
  75.     stored file attributes, since we didn't do that when we opened the dude.
  76.   ---------------------------------------------------------------------------*/
  77.  
  78.     close(outfd);
  79.  
  80. #ifdef __TURBOC__
  81.     if (_chmod(filename, 1, pInfo->file_attr) != pInfo->file_attr)
  82.         fprintf(stderr, "\nwarning:  file attributes may not be correct\n");
  83. #endif
  84.  
  85. } /* end function set_file_time_and_close() */
  86.